package persentation.presentAdministrator;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;

import java.awt.Color;
import java.awt.Font;

import javax.swing.JButton;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.ImagingOpException;


public class Title extends JPanel{
	private ImageIcon titleIcon;
	private JLabel titlelLabel;
	private JFrame frame;
	private JButton button;
	private ImageIcon exitImageIcon;
	private ImageIcon exitImageIcon2;
	
	/**
	 * Create the panel.
	 */
	public Title(String teacherName) {
		setSize(1100, 74);
		setLayout(null);
		setBackground(new Color(192, 192, 192));
		

		
		

		exitImageIcon=new ImageIcon("Graphics/adminGraphics/注销图标.png");
		exitImageIcon2=new ImageIcon("Graphics/adminGraphics/高光注销图标.png");
		button = new JButton(exitImageIcon);
		button.setFont(new Font("微软雅黑", Font.PLAIN, 29));
		button.setBounds(954, 0, 111, 60);
		button.setOpaque(false);
		button.setContentAreaFilled(false);
		button.setBorderPainted(false);
		button.setToolTipText("退出");
		add(button);
		button.addMouseListener(new MouseListener() {
			
			@Override
			public void mouseReleased(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mousePressed(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseExited(MouseEvent arg0) {
				button.setBounds(954, 0, 111, 60);
				button.setIcon(exitImageIcon);
			}
			
			@Override
			public void mouseEntered(MouseEvent arg0) {
				button.setBounds(957, 0, 111, 60);
				button.setIcon(exitImageIcon2);
			}
			
			@Override
			public void mouseClicked(MouseEvent arg0) {
				int message=JOptionPane.showConfirmDialog(null,"确认退出系统？","确认",JOptionPane.YES_NO_OPTION);
				if(message==JOptionPane.YES_OPTION){
					System.exit(0);
				}
			}
		});
		
		
		

		
		titleIcon=new ImageIcon("Graphics/adminGraphics/title.png");
		titlelLabel=new JLabel(titleIcon);
		titlelLabel.setBounds(0,-23,1100,101);
		this.add(titlelLabel);

	}
	
//	public void paint(Graphics g){
//		g.drawImage(TITLE, 0, 0, 1100,130,,null);
//	}
	
	public void setFrame(JFrame frame){
		this.frame=frame;
	}
	
	
}
